package com.glela.company.service.impl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.glela.company.mapper.XzOmsLogMapper;
import com.glela.company.model.XzOmsLog;
import com.glela.company.service.XzOmsLogService;

/**
 *@author liujie
 *@2017年1月3日
 */
@Service("xzOmsLogService")
public class XzOmsLogServiceImpl implements XzOmsLogService{
	@Autowired
	private XzOmsLogMapper xzOmsLogMapper;

	@Override
	public int insertSelective(XzOmsLog record) {
		if (record == null || StringUtils.isBlank(record.getOrderSn())) {
			throw new NullPointerException("推送日志记录失败");
		}
		return xzOmsLogMapper.insertSelective(record);
	}

	@Override
	public int deleteByPrimaryOrderSn(String orderSn) {
		if (StringUtils.isEmpty(orderSn)) {
			throw new NullPointerException("删除推送日志异常");
		}
		return xzOmsLogMapper.deleteByPrimaryOrderSn(orderSn);
	}

	@Override
	public int deleteByPrimaryOrderSn(String orderSn, String orderInfoSn) {
		if (StringUtils.isEmpty(orderSn) || StringUtils.isEmpty(orderInfoSn)) {
			throw new NullPointerException("删除推送日志异常");
		}
		return xzOmsLogMapper.deleteByOrderSnAndOrderInfoSn(orderSn, orderInfoSn);
	}

	@Override
	public List<String> selectAutoPushOrder() {
		// TODO Auto-generated method stub
		return xzOmsLogMapper.selectAutoPushOrder();
	}

	@Override
	public XzOmsLog selectAutoPushOrderByOrderSn(String orderSn) {
		return xzOmsLogMapper.selectAutoPushOrderByOrderSn(orderSn);
	}
	
}
